knitr::opts_chunk$set(echo = TRUE)
blocks_india <- read.csv("merged_data.csv")
library(sf)
library(sf)
library(dplyr)
library(ggplot2)
library(dplyr)
library(ggplot2)
library(ggthemes)
library(patchwork)
library(stringr)
data<- read.csv("scheduled_areas_by_subdistrict_india.csv")
View(data)
View(blocks_india)
blocks_india <- blocks_india %>%
left_join(data %>% select(subdistrict_id, scheduled_status), by = "subdistrict_id") %>%
mutate(scheduled_status = ifelse(scheduled_status == "Fifth Schedule", 5, scheduled_status)) %>%
select(-scheduled_status.y) %>% # remove the extra column if it appears after the join
rename(scheduled_status = scheduled_status.x) # keep the original name
blocks_india <- blocks_india %>%
left_join(data %>% select(subdistrict_id, scheduled_status), by = "pc11_subdistrict_id") %>%
mutate(scheduled_status = ifelse(scheduled_status == "Fifth Schedule", 5, scheduled_status)) %>%
select(-scheduled_status.y) %>% # remove the extra column if it appears after the join
rename(scheduled_status = scheduled_status.x) # keep the original name
blocks_india <- blocks_india %>%
left_join(data %>% select(pc11_subdistrict_id, scheduled_status), by = "pc11_subdistrict_id") %>%
mutate(scheduled_status = ifelse(scheduled_status == "Fifth Schedule", 5, scheduled_status)) %>%
select(-scheduled_status.y) %>% # remove the extra column if it appears after the join
rename(scheduled_status = scheduled_status.x) # keep the original name
summary(blocks_india)
summary(data)
blocks_india <- read.csv("merged_data.csv")
data<- read.csv("scheduled_areas_by_subdistrict_india.csv")
summary(blocks_india)
summary(data)
blocks_india$scheduled_status[blocks_india$pc11_subdistrict_id %in%
data$pc11_subdistrict_id[data$scheduled_status == "Fifth Schedule"]] <- 5
View(blocks_india)
View(data)
blocks_india <- read.csv("merged_data.csv")
View(blocks_india)
data<- read.csv("scheduled_areas_by_subdistrict_india.csv")
summary(blocks_india)
summary(data)
blocks_india$scheduled_status[blocks_india$pc11_subdistrict_id %in%
data$pc11_subdistrict_id[data$scheduled_status == "Fifth Schedule"]] <- 5
blocks_india$scheduled_status[blocks_india$pc11_subdistrict_id %in%
data$pc11_subdistrict_id[data$scheduled_status == "Fifth Schedule"]] <- 5
write.csv(blocks_india, "merged_data2.csv")
